const mongoose = require('mongoose'),
Schema = mongoose.Schema

// 定义数据模型
// 模型中的属性为数据库字段
const subscriberSchema = new mongoose.Schema({
  name:{
    type: String,
    required: true
  },
  category_id: {
    type: Schema.Types.ObjectId, 
    ref: 'Category',
  },
  subscribedChannel: {
    type: String,
    required: true
  }
},{timestamps: true})
// timestamps为true可以为我们的数据增加createdAt,updatedAt属性

// 导出模型
module.exports = mongoose.model('Subscriber', subscriberSchema)